const unitObj = {
  NUMBER: '套',
  AMOUNT: '万',
  AREA: '㎡'
}
const labelObj = {
  NUMBER: '套数',
  AMOUNT: '金额',
  AREA: '面积'
}
let labelObj1 = {
  CLUETARGET: '线索',
  VISITOR: '来人',
  SUBSCRIPTION: '认购',
  CONTRACT: '签约',
  PAYMENT: '回款'
}
// const CLUETARGET = [
//   {
//     key: 'initTarget',
//     value: '初始目标(组)'
//   },
//   {
//     key: 'adjustmentTarget',
//     value: '调整目标(组)'
//   },
//   {
//     key: 'diff',
//     value: '调整差(组)'
//   },
//   {
//     key: 'updateNumber',
//     value: '调整次数'
//   },
//   {
//     key: 'actual',
//     value: `实际${labelObj1[curState]}(${unitObj[unitState]})`
//   },
//   {
//     key: 'reach',
//     value: '达成率'
//   }
// ]
function clueTarget(key) {
  console.log('zhk ~ file: countList.js:45 ~ clueTarget ~ key, unitState):', key)
  return [
    {
      key: 'initTarget',
      value: '初始目标(组)'
    },
    {
      key: 'adjustmentTarget',
      value: '调整目标(组)'
    },
    {
      key: 'diff',
      value: '调整差(组)'
    },
    {
      key: 'updateNumber',
      value: '调整次数'
    },
    {
      key: 'actual',
      value: `实际${labelObj1[key]}(${key != 'PAYMENT' ? '组' : '万'})`
    },
    {
      key: 'reach',
      value: '达成率'
    }
  ]
}
function orderList(unitState) {
  return [
    {
      key: 'initTarget',
      value: `初始${labelObj[unitState]}目标(${unitObj[unitState]})`
    },
    {
      key: 'adjustmentTarget',
      value: `调整${labelObj[unitState]}目标(${unitObj[unitState]})`
    },
    {
      key: 'diff',
      value: `调整差(${unitObj[unitState]})`
    },
    {
      key: 'updateNumber',
      value: '调整次数'
    },
    {
      key: 'actual',
      value: `实际${labelObj[unitState]}(${unitObj[unitState]})`
    },
    {
      key: 'reach',
      value: '达成率'
    }
  ]
}
function getTabsType(tabsType, otherState) {
  let list = []
  switch (tabsType) {
    case 'CLUETARGET':
      list = clueTarget(tabsType)
      break
    case 'VISITOR':
      list = clueTarget(tabsType)
      break
    case 'SUBSCRIPTION':
      list = orderList(otherState)
      break
    case 'CONTRACT':
      list = orderList(otherState)
      break
    case 'PAYMENT':
      list = clueTarget(tabsType)
      break
    default:
      list = []
      break
  }
  return list
}

function countList(key, otherState) {
  let list = []
  let p1 = [
    {
      key: 'buildingName',
      value: '案场名称'
    },
    {
      key: 'state',
      value: '目标状态'
    },
    {
      key: 'stateStr',
      value: '案场状态'
    }
  ]
  list = [...p1, ...getTabsType(key, otherState)]
  return list
}

export default countList
